import { http } from '@/utils/axios/init'

export interface BasicResponseModel<T = any> {
  code: number
  msg: string
  data: T
}
// 字段列表
export function fieldlist(params) {
  return http.request<BasicResponseModel>({
    url: '/common/Rest/business/field/listByPage',
    method: 'get',
    params
  })
}
// 业务字段列表
export function businessFieldlist(params = {}) {
  return http.request<BasicResponseModel>({
    url: '/common/Rest/business/group/field/list',
    method: 'get',
    params
  })
}

// 新增字段
export function fieldAdd(params) {
  return http.request<BasicResponseModel>({
    url: '/common/Rest/business/field/save',
    method: 'post',
    params
  })
}
// 编辑字段
export function fieldUpdate(params) {
  return http.request<BasicResponseModel>({
    url: '/common/Rest/business/field/update',
    method: 'post',
    params
  })
}
// 字段详情
export function fieldDetail(params) {
  return http.request<BasicResponseModel>({
    url: '/common/Rest/business/field/detail',
    method: 'get',
    params
  })
}
// 多字段详情
export function fieldDetailList(params) {
  return http.request<BasicResponseModel>({
    url: '/common/Rest/business/field/list/detail',
    method: 'get',
    params
  })
}
// 删除字段
export function fieldDelete(params) {
  return http.request<BasicResponseModel>({
    url: '/common/Rest/business/field/delete',
    method: 'post',
    params
  })
}

// 业务字段分类列表
export function businessGroupList(params = {}) {
  return http.request<BasicResponseModel>({
    url: '/common/Rest/business/group/list',
    method: 'get',
    params
  })
}

// 新增业务字段分类
export function addBusinessGroup(params) {
  return http.request<BasicResponseModel>({
    url: '/common/Rest/business/group/save',
    method: 'post',
    params
  })
}

//编辑业务字段分类
export function editBusinessGroup(params) {
  return http.request<BasicResponseModel>({
    url: '/common/Rest/business/group/update',
    method: 'post',
    params
  })
}

//删除业务字段分类
export function delBusinessGroup(params) {
  return http.request<BasicResponseModel>({
    url: '/common/Rest/business/group/delete',
    method: 'post',
    params
  })
}
